from selenium import webdriver
import time
from selenium.webdriver.common.by import By

driver = webdriver.Chrome()
driver.maximize_window()
driver.get("https://www.baidu.com")
time.sleep(2)
driver.find_element_by_id('kw').send_keys("坚果")
driver.find_element_by_id('su').click()
time.sleep(2)

for i in range(1, 8):
    y_value = 200*i
    # js = "window.scrollTo(0,{})".format(y_value)
    js = "var q=document.documentElement.scrollTop={}".format(y_value)
    driver.execute_script(js)
    time.sleep(2)

driver.quit()
